home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / program / wthrds.zip / THRDAPI.PAS < prev    next >
Pascal/Delphi Source File  |  1992-05-29  |  4KB  |  131 lines

  1. Unit ThrdAPI;
  2.  
  3. {
  4. ********************************************************************
  5. *                    EDI Threads Pascal Interface                  *
  6. *                                                                  *
  7. ********************************************************************
  8. *       Copyright 1992 Robert Salesas, All Rights Reserved         *
  9. ********************************************************************
  10. *      Version: 1.00             Author:  Robert Salesas           *
  11. *      Date:    22-May-1992      Changes: Original                 *
  12. *                                                                  *
  13. ********************************************************************
  14. }
  15.  
  16.  
  17. Interface
  18.  
  19.  
  20. Uses WinTypes;
  21.  
  22.  
  23.  
  24. Type
  25.   PThreadRec = Pointer;
  26.  
  27.   PThreadFunc = ^TThreadFunc;
  28.   TThreadFunc = Procedure(Thread : PThreadRec;  Wnd : HWnd;  wParam : Word;  lParam : LongInt);
  29.  
  30.  
  31. Const
  32.   tm_User     = $0100;                { Starting user message to pass to a thread }
  33.   tm_Quit     = $0001;                { Thread has ended or must end }
  34.   tm_Continue = $0002;                { Thread can continue or is continuing }
  35.   tm_Paused   = $0003;                                { Thread is currently paused }
  36.  
  37.   ts_DefTimeSlice = 50;               { Default time slice }
  38.   ts_DefPriority  = 100;              { Default thread priority }
  39.  
  40.  
  41.   Function GetThrdUtlsVersion : Word;
  42.   { Returns major revision in high byte, minor revision in low byte. }
  43.  
  44.   Function GetNumThreads : Word;
  45.  
  46.   Procedure SetThrdUtlsTimeSlice(ATimeSlice : Word);
  47.  
  48.  
  49.   Function CreateThread(ThreadFunc : PThreadFunc;  StackSize : Word;
  50.                         Wnd : HWnd;  wParam : Word;  lParam : LongInt) : PThreadRec;
  51.  
  52.   Procedure DisposeThread(Var Thread : PThreadRec);
  53.  
  54.   Function ExecThread(Thread : PThreadRec) : Word;
  55.  
  56.   Function YieldThread : Word;
  57.  
  58.   Procedure ExitThread;
  59.  
  60.   Procedure TerminateThread(Thread : PThreadRec);
  61.  
  62.   Procedure SetThreadPriority(Thread : PThreadRec;  Priority : Word);
  63.  
  64.   Procedure SetThreadPause(Thread : PThreadRec;  Paused : Bool);
  65.  
  66.   Function IsThreadPaused(Thread : PThreadRec) : Bool;
  67.  
  68.   Function IsThreadFinished(Thread : PThreadRec) : Bool;
  69.  
  70.   
  71.   Function AddThread(Thread : PThreadRec) : Bool;
  72.  
  73.   Procedure RemoveThread(Thread : PThreadRec);
  74.  
  75.   Function StartThread(ThreadFunc : PThreadFunc;  StackSize : Word;
  76.                        Wnd : HWnd;  wParam : Word;  lParam : LongInt) : PThreadRec;
  77.  
  78.   Procedure EndThread(Var Thread : PThreadRec);
  79.  
  80.   Procedure ExecTaskThreads(Task : THandle);
  81.  
  82.   Procedure EndTaskThreads(Task : THandle);
  83.  
  84.  
  85.  
  86.  
  87. Implementation
  88.  
  89.  
  90.   Function GetThrdUtlsVersion;  External 'THRDUTLS' Index 100;
  91.  
  92.   Function GetNumThreads;  External 'THRDUTLS' Index 110;
  93.  
  94.   Procedure SetThrdUtlsTimeSlice;  External 'THRDUTLS' Index 120;
  95.  
  96.  
  97.   Function CreateThread;  External 'THRDUTLS' Index 200;
  98.  
  99.   Procedure DisposeThread;  External 'THRDUTLS' Index 210;
  100.  
  101.   Function ExecThread;  External 'THRDUTLS' Index 220;
  102.  
  103.   Function YieldThread;  External 'THRDUTLS' Index 230;
  104.  
  105.   Procedure ExitThread;  External 'THRDUTLS' Index 240;
  106.  
  107.   Procedure TerminateThread;  External 'THRDUTLS' Index 250;
  108.  
  109.   Procedure SetThreadPriority;  External 'THRDUTLS' Index 260;
  110.  
  111.   Procedure SetThreadPause;  External 'THRDUTLS' Index 270;
  112.  
  113.   Function IsThreadPaused;  External 'THRDUTLS' Index 280;
  114.  
  115.   Function IsThreadFinished;  External 'THRDUTLS' Index 290;
  116.  
  117.  
  118.   Function AddThread;  External 'THRDUTLS' Index 300;
  119.  
  120.   Procedure RemoveThread;  External 'THRDUTLS' Index 310;
  121.  
  122.   Function StartThread;  External 'THRDUTLS' Index 320;
  123.  
  124.   Procedure EndThread;  External 'THRDUTLS' Index 330;
  125.  
  126.   Procedure ExecTaskThreads;  External 'THRDUTLS' Index 340;
  127.  
  128.   Procedure EndTaskThreads;  External 'THRDUTLS' Index 350;
  129.  
  130.  
  131. End. {ThrdAPI}